<template>
	<view class="container">
		<view class="list" v-for="(item,index) in infoList" :key="index">
			<view class="title">
				<u-icon size="20" color="#53c21d" name="attach"></u-icon>
				<text>{{$t('homepage.AccessoryManagement.billNo')}}{{$t('public.colon')}}{{item.billNo}}</text>
			</view>
			<view class="content">
				<view class="text">
					<text class="sub">{{$t('homepage.AccessoryManagement.apply_status')}}</text>
					<view class="subContent" v-if="item.billStatus==0">
						<image class="img" src="@/static/assets/homepage/blueCircle.png"></image>{{$t('homepage.AccessoryManagement.receive')}}
					</view>
					<view class="subContent" v-if="item.billStatus==1">
						<image class="img" src="@/static/assets/homepage/redCircle.png"></image>{{$t('homepage.AccessoryManagement.unreceive')}}
					</view>
				</view>
				<view class="text">
					<text class="sub">{{$t('homepage.AccessoryManagement.apply_dept')}}</text>
					<view class="subContent">{{item.applyDeptName}}</view>
				</view>
				<view class="text">
					<text class="sub">{{$t('homepage.AccessoryManagement.apply_num')}}</text>
					<view class="subContent">{{item.billNum}}{{$t('public.piece')}}</view>
				</view>
				<view class="text">
					<text class="sub">{{$t('homepage.AccessoryManagement.bill_user_name')}}</text>
					<view class="subContent">{{item.billUserName}}</view>
				</view>
				<view class="text">
					<text class="sub">{{$t('homepage.AccessoryManagement.bill_date')}}</text>
					<view class="subContent">{{item.billDate}}</view>
				</view>
			</view>
			<view class="btn">
				<u-button :text="$t('public.detailInfo')" class="detail"
					color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" @click="goDetail(item)">
				</u-button>
			</view>
		</view>
		<!-- 弹出层 -->
		<u-popup :show="show" mode="center" :round="10" :closeable="true" @close="close" zIndex="999999">
			<view class="detailTable">
				<scroll-view scroll-y="true" style="height: 46vh;" scroll-with-animation="true">
					<zy-table :headList="headList" :dataList="dataList"></zy-table>
				</scroll-view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		applyDetailQueryListMap
	} from "@/api/homepage.js"
	export default {
		data() {
			return {
				show: false,
				headList: [{
						key: 'spec',
						name: this.$t('public.spec')
					},
					{
						key: 'name',
						name: this.$t('public.name')
					},
					{
						key: 'num',
						name: this.$t('public.num')
					},
				],
				dataList: [],
			}
		},
		props: {
			infoList: {
				type: Array,
				default: []
			}
		},
		methods: {
			// 弹出层关闭
			close() {
				this.show = false
			},
			goDetail(item) {
				this.show = true
				applyDetailQueryListMap().then((res) => {
					this.dataList = res.data
				})
			},
		}
	};
</script>

<style lang="scss" scoped>
	.container {
		margin-bottom: 50px;
	}

	.list {
		width: 89vw;
		height: 210px;
		margin: 5px 10px;
		padding: 10px;
		background-color: #Fff;
		border-radius: 8px;
	}

	.title {
		padding-bottom: 5px;
		display: flex;
		font-size: 14px;
		font-weight: 800;
		border-bottom: 1px dashed #eaebee;
	}

	.text {
		color: #ccc;
		padding: 6px 3px;
		font-size: 14px;
		display: flex;
	}

	.sub {
		text-align: left;
	}

	.subContent {
		width: 68vw;
		text-align: right;
	}

	.img {
		width: 13px;
		height: 13px;
	}

	.btn {
		width: 36%;
		margin: 0 auto;
	}

	.detail {
		word-spacing: 2px;
		height: 30px;
		border-radius: 50px;
	}

	.detailTable {
		height: 50vh;
		padding: 40px 20px 20px 20px;
		justify-content: center;
	}
</style>
